home *** CD-ROM | disk | FTP | other *** search
/ Aminet 51 / Aminet 51 (2002)(GTI - Schatztruhe)[!][Oct 2002].iso / Aminet / dev / c / minigl.lha / MiniGL / src_experimental / glarrayelement.c next >
Encoding:
Text File  |  2002-07-01  |  1.3 KB  |  58 lines

  1.  
  2. //Note:    GLEnd should wrap to some proper drawfuncs
  3. //        drawfuncs would handle texcoords and colors
  4. //        after culling
  5.  
  6. void GLArrayElement(GLcontext context, GLint i)
  7. {
  8.     int thisvert;
  9.     MGLVertex *v;
  10.  
  11.     thisvert = context->VertexBufferPointer;
  12.  
  13.     //store pos for eventual colors and texcoords
  14.     context->ElementIndex[thisvert] = i;
  15.  
  16.     //check for locked arrays
  17.     if(context->ArrayPointer.transformed == GL_TRUE)
  18.     {
  19.         thisvert += context->ArrayPointer.lockfirst + context->ArrayPointer.locksize;
  20.  
  21.         v = &(context->VertexBuffer[thisvert]);
  22.  
  23.         if(Clip_Volume_Bypass == GL_FALSE && v->outcode == 0)
  24.         {
  25.             v->v.x = context->VertexBuffer[i].v.x;
  26.             v->v.y = context->VertexBuffer[i].v.y;
  27.             v->v.z = context->VertexBuffer[i].v.z;
  28.             v->v.w = context->VertexBuffer[i].v.w;
  29.  
  30.             v->bx = context->VertexBuffer[i].bx;
  31.             v->by = context->VertexBuffer[i].by;
  32.             v->bz = context->VertexBuffer[i].bz;
  33.             v->bw = context->VertexBuffer[i].bw;
  34.         }
  35.         else
  36.         {
  37.             v->bx = context->VertexBuffer[i].bx;
  38.             v->by = context->VertexBuffer[i].by;
  39.             v->bz = context->VertexBuffer[i].bz;
  40.             v->bw = context->VertexBuffer[i].bw;
  41.         }
  42.  
  43.     }
  44.     else
  45.     {
  46.         GLfloat *vert;
  47.         vert = (GLfloat *)(context->ArrayPointer.verts + i * context->ArrayPointer.vertexstride);
  48.  
  49.         v = &(context->VertexBuffer[thisvert]);
  50.  
  51.         v->bx = vert[0];
  52.         v->by = vert[1];
  53.         v->bz = vert[2];
  54.         v->bw = 1.0;
  55.     }
  56.  
  57.     context->VertexBufferPointer++;
  58. }